//
//  LOLNewsScrollView.m
//  LOLNews
//
//  Created by ArihinM on 16/10/29.
//  Copyright © 2016年 KK. All rights reserved.
//

#import "LOLNewsScrollView.h"
#import "UIViewController+CZAddition.h"
#import "CZAdditions.h"
#import "Masonry.h"

@implementation LOLNewsScrollView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

#pragma mark - 设置界面
- (void)setupUI {
    //scrollView属性
    self.pagingEnabled = NO;
    self.bounces = NO;
//    self.delegate = 
    UIView *contentView = [[UIView alloc]init];
    //背景颜色
    contentView.backgroundColor = [UIColor cz_randomColor];
    [self addSubview:contentView];
    
    [contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
        make.width.equalTo(self).multipliedBy(5);
        make.height.mas_equalTo(self);
    }];
    
//    NSArray *array = @[@"LOLNewsController",@"LOLActivityController",@"LOLAmuseController",@"LOLOfficialController",@"LOLStrategyController"];
//    NSInteger index = 0;
//    
//    for (NSString *vcName in array) {
//        // 将控制器字符串名转成Class
//        Class class = NSClassFromString(vcName);
//        // 断言
//        NSAssert( [class isSubclassOfClass:[UIViewController class]], @"不是控制器不要给我");
//        // 创建控制器
//        UIViewController *vc =  [[class alloc] init];
//        // 添加子控制器
//        [self lol_addChildViewController:vc intoView:contentView];
//        // 获得屏幕的宽度
//        CGFloat screenW = [UIScreen mainScreen].bounds.size.width;
//        // 添加约束
//        [vc.view mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.bottom.equalTo(contentView);
//            make.width.mas_equalTo(scrollView);
//            make.left.mas_equalTo(scrollView).offset(screenW * index);
//        }];
//        // 索引 ++
//        index ++;
//    }
    
    
}

//- (void)lol_addChildViewController:(UIViewController *)childVc intoView:(UIView *)contentView withViewController:(UIViewController *)controller{
//    // 添加控制器的view
//    [contentView addSubview:childVc.view];
//    // 添加子控制器
//    [controller addChildViewController:childVc];
//    // 完成子控制器的添加
//    [childVc didMoveToParentViewController:controller];
//}

@end
